<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="s"  uri="/struts-tags" %>
<%@ taglib prefix="c"  uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix='fmt' uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/html">
<head>
   	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta http-equiv="X-UA-Compatible" content="chrome=1">
    <link href="<%=request.getContextPath()%>/css/bootstrap.css" rel="stylesheet" type="text/css">
    <script src="<%=request.getContextPath()%>/js/jquery-2.0.3.min.js" type="text/javascript"></script>
    <script src="<%=request.getContextPath()%>/js/bootstrap.js" type="text/javascript"></script>  
    <link rel="stylesheet" href="<%=request.getContextPath()%>/css/bootstrapValidator.css"/>
    <script type="text/javascript" src="<%=request.getContextPath()%>/js/bootstrapValidator.js"></script>
    <script src="<%=request.getContextPath()%>/js/jquery.twbsPagination.js" type="text/javascript"></script>   
    <script type="text/javascript">
    $(document).ready(function () {
	    $('#pagination-demo').twbsPagination({	    	
	        totalPages: ${pageCount},
	        visiblePages: ${pageCount}>10?10:${pageCount},
			startPage:${page},
	        version: '1.1',
	        first: "首页",
	        last: "未页",
	        prev: '上一页',
	        next: '下一页',
	        onPageClick: function (event, page) {	        	
	        	if(page!=${page}){
					document.getElementById("defaultForm").action="<%=request.getContextPath()%>/category/category_listByPage.action?t1.level=4&page="+ page +"&rows=10";
        		    document.getElementById("defaultForm").submit();
	        	}	        	
	        }
	    });

    });
    </script>
</head>

<body>
<div class="panel panel-primary">
    <div class="panel-heading">商品4级类别管理</div>
    <div class="panel-body"> 

		<form class="form-horizontal" id="defaultForm" action="category_listByPage" method="post">
		  	<table>
		  		<tr>
		  		    <input type="hidden" name="t1.level" id="level" value="4">
		  			<td><input type="text" name="t1.name" class="form-control" id="name" placeholder="请输入类别名称" style="width: 150px"  value="${t1.name}"></td>
		  			<td><button type="submit" class="btn btn-default">查询</button></td>
		  		</tr>
		  	</table>
		</form>
 
    </div>
  
  
        <table class="table table-bordered table-hover">
            <thead>
			    <tr>
					 <th>4级类别名称</th>
			         <th>操作</th>
			    </tr>
		    </thead>
		    <s:iterator value="#list">
			    <tr>
					 <th>${name}</th>
			        <th>
				        <input type="hidden" name="nameChoose" id="${id }" value="${name }"/>
						<input type="radio" name="idChoose" value="${id }"/>
			        </th>
			    </tr>        
		    </s:iterator>
		</table>    
</div>
	
		<section id="main-content">
		    <p>
		        <div class="text-center" display="inline">
		            <ul id="pagination-demo" class="pagination-sm">&nbsp;&nbsp;&nbsp;共${pageCount}页</ul>
		        </div>
		    </p>
		</section> 

</body>
</html>
